# YunCha-Coffee PyCharm
# config 86155
# 2025/8/31 21:15
import os
from pathlib import Path

# 项目根目录（app文件夹的父目录）
BASE_DIR = Path(__file__).resolve().parent.parent

# 静态文件目录
STATIC_DIR = BASE_DIR / "static"

# 各种文件类型的子目录配置
FILE_UPLOAD_CONFIG = {
    "user_avatars": {
        "subfolder": "user_avatars",
        "allowed_types": {"image/jpeg", "image/png", "image/gif", "image/webp"},
        "max_size": 2 * 1024 * 1024,  # 2MB
    },
    "coffee_products": {
        "subfolder": "coffee_products",
        "allowed_types": {"image/jpeg", "image/png", "image/gif", "image/webp"},
        "max_size": 5 * 1024 * 1024,  # 5MB
    },
    "merchandise_products": {
        "subfolder": "merchandise_products",
        "allowed_types": {"image/jpeg", "image/png", "image/gif", "image/webp"},
        "max_size": 5 * 1024 * 1024,  # 5MB
    },
    "reviews": {
        "subfolder": "reviews",
        "allowed_types": {"image/jpeg", "image/png", "image/gif", "image/webp"},
        "max_size": 3 * 1024 * 1024,  # 3MB
    }
}

# 确保所有目录都存在
for config in FILE_UPLOAD_CONFIG.values():
    os.makedirs(STATIC_DIR / config["subfolder"], exist_ok=True)